home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / c / gcc261ud-c.lha / gnu / lib / gcc-lib / mc68000-cbm-amigados / 2.6.1 / include / stddef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-05  |  8.3 KB  |  308 lines

  1. #ifndef _STDDEF_H
  2. #ifndef _STDDEF_H_
  3. #ifndef _ANSI_STDDEF_H
  4. #ifndef __STDDEF_H__
  5.  
  6. #ifdef amigados
  7.  
  8. /* GNU libc has special support in this file, 4.3bsd-net2 libc deserves that
  9.    just as well. The system headers are ANSI compliant, the used compiler IS
  10.    gcc, so it's really ok to use the system header, no reason to hassle
  11.    with a jungle of ifdefs. Besides, amigados is only defined if compiling
  12.    with host=amigados, it doesn't apply if compiling with target=amigados
  13.    on a different host with possibly different system headers. Same thing
  14.    would apply to gstdarg.h and gvarargs.h, but those headers are more
  15.    easily fixable than this one and I'm sick of writing the same comment
  16.    there as well. MW
  17.  
  18.    Include the contents of <stddef.h> inline rather than with a #include,
  19.    to avoid infinite include recursion when this file is installed in
  20.    gcc's include directory as stddef.h.  (fnf)  */
  21.  
  22. #define _STDDEF_H_
  23.  
  24. #include <machine/ansi.h>
  25.  
  26. typedef    _PTRDIFF_T_    ptrdiff_t;
  27.  
  28. #ifdef    _SIZE_T_
  29. typedef    _SIZE_T_    size_t;
  30. #undef    _SIZE_T_
  31. #endif
  32.  
  33. #ifdef    _WCHAR_T_
  34. typedef    _WCHAR_T_    wchar_t;
  35. #undef    _WCHAR_T_
  36. #endif
  37.  
  38. #ifndef    NULL
  39. #define    NULL    0
  40. #endif
  41.  
  42. #define    offsetof(type, member)    ((size_t)(&((type *)0)->member))
  43.  
  44. #else /* not amigados */
  45.  
  46. /* Any one of these symbols __need_* means that GNU libc
  47.    wants us just to define one data type.  So don't define
  48.    the symbols that indicate this file's entire job has been done.  */
  49. #if (!defined(__need_wchar_t) && !defined(__need_size_t)    \
  50.      && !defined(__need_ptrdiff_t) && !defined(__need_NULL))
  51. #define _STDDEF_H
  52. #define _STDDEF_H_
  53. /* snaroff@next.com says the NeXT needs this.  */
  54. #define _ANSI_STDDEF_H
  55. /* Irix 5.1 needs this.  */
  56. #define __STDDEF_H__
  57. #endif
  58.  
  59. #ifndef __sys_stdtypes_h
  60. /* This avoids lossage on SunOS but only if stdtypes.h comes first.
  61.    There's no way to win with the other order!  Sun lossage.  */
  62.  
  63. /* On 4.3bsd-net2, make sure ansi.h is included, so we have
  64.    one less case to deal with in the following.  */
  65. #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__)
  66. #include <machine/ansi.h>
  67. #endif
  68.  
  69. /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
  70.     defined if the corresponding type is *not* defined.  */
  71. #ifdef _ANSI_H_
  72. #ifndef _SIZE_T_
  73. #define _SIZE_T
  74. #endif
  75. #ifndef _PTRDIFF_T_
  76. #define _PTRDIFF_T
  77. #endif
  78. /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
  79.    instead of _WCHAR_T_. */
  80. #ifndef _WCHAR_T_
  81. #ifndef _BSD_WCHAR_T_
  82. #define _WCHAR_T
  83. #endif
  84. #endif
  85. /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  86. #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  87. #undef _PTRDIFF_T_
  88. #endif
  89. #if defined (__need_size_t) || defined (_STDDEF_H_)
  90. #undef _SIZE_T_
  91. #endif
  92. #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  93. #undef _WCHAR_T_
  94. #endif
  95. #endif /* _ANSI_H_ */
  96.  
  97. /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
  98.    Just ignore it.  */
  99. #if defined (__sequent__) && defined (_PTRDIFF_T_)
  100. #undef _PTRDIFF_T_
  101. #endif
  102.  
  103. /* In case nobody has defined these types, but we aren't running under
  104.    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
  105.    __WCHAR_TYPE__ have reasonable values.  This can happen if the
  106.    parts of GCC is compiled by an older compiler, that actually
  107.    include gstddef.h, such as collect2.  */
  108.  
  109. /* Signed type of difference of two pointers.  */
  110.  
  111. /* Define this type if we are doing the whole job,
  112.    or if we want this type in particular.  */
  113. #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
  114. #ifndef _PTRDIFF_T    /* in case <sys/types.h> has defined it. */
  115. #ifndef _T_PTRDIFF_
  116. #ifndef _T_PTRDIFF
  117. #ifndef __PTRDIFF_T
  118. #ifndef _PTRDIFF_T_
  119. #ifndef ___int_ptrdiff_t_h
  120. #ifndef _GCC_PTRDIFF_T
  121. #define _PTRDIFF_T
  122. #define _T_PTRDIFF_
  123. #define _T_PTRDIFF
  124. #define __PTRDIFF_T
  125. #define _PTRDIFF_T_
  126. #define ___int_ptrdiff_t_h
  127. #define _GCC_PTRDIFF_T
  128. #ifndef __PTRDIFF_TYPE__
  129. #define __PTRDIFF_TYPE__ long int
  130. #endif
  131. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  132. #endif /* _GCC_PTRDIFF_T */
  133. #endif /* ___int_ptrdiff_t_h */
  134. #endif /* _PTRDIFF_T_ */
  135. #endif /* __PTRDIFF_T */
  136. #endif /* _T_PTRDIFF */
  137. #endif /* _T_PTRDIFF_ */
  138. #endif /* _PTRDIFF_T */
  139.  
  140. /* If this symbol has done its job, get rid of it.  */
  141. #undef    __need_ptrdiff_t
  142.  
  143. #endif /* _STDDEF_H or __need_ptrdiff_t.  */
  144.  
  145. /* Unsigned type of `sizeof' something.  */
  146.  
  147. /* Define this type if we are doing the whole job,
  148.    or if we want this type in particular.  */
  149. #if defined (_STDDEF_H) || defined (__need_size_t)
  150. #ifndef _SIZE_T    /* in case <sys/types.h> has defined it. */
  151. #ifndef _SYS_SIZE_T_H
  152. #ifndef _T_SIZE_
  153. #ifndef _T_SIZE
  154. #ifndef __SIZE_T
  155. #ifndef _SIZE_T_
  156. #ifndef _SIZE_T_DEFINED_
  157. #ifndef ___int_size_t_h
  158. #ifndef _GCC_SIZE_T
  159. #ifndef _SIZET_
  160. #ifndef __size_t
  161. #define _SIZE_T
  162. #define _SYS_SIZE_T_H
  163. #define _T_SIZE_
  164. #define _T_SIZE
  165. #define __SIZE_T
  166. #define _SIZE_T_
  167. #define _SIZE_T_DEFINED_
  168. #define ___int_size_t_h
  169. #define _GCC_SIZE_T
  170. #define _SIZET_
  171. #define __size_t
  172. #ifndef __SIZE_TYPE__
  173. #define __SIZE_TYPE__ long unsigned int
  174. #endif
  175. #if !(defined (__GNUG__) && defined (size_t))
  176. typedef __SIZE_TYPE__ size_t;
  177. #endif /* !(defined (__GNUG__) && defined (size_t)) */
  178. #endif /* __size_t */
  179. #endif /* _SIZET_ */
  180. #endif /* _GCC_SIZE_T */
  181. #endif /* ___int_size_t_h */
  182. #endif /* _SIZE_T_DEFINED_ */
  183. #endif /* _SIZE_T_ */
  184. #endif /* __SIZE_T */
  185. #endif /* _T_SIZE */
  186. #endif /* _T_SIZE_ */
  187. #endif /* _SYS_SIZE_T_H */
  188. #endif /* _SIZE_T */
  189. #undef    __need_size_t
  190. #endif /* _STDDEF_H or __need_size_t.  */
  191.  
  192.  
  193. /* Wide character type.
  194.    Locale-writers should change this as necessary to
  195.    be big enough to hold unique values not between 0 and 127,
  196.    and not (wchar_t) -1, for each defined multibyte character.  */
  197.  
  198. /* Define this type if we are doing the whole job,
  199.    or if we want this type in particular.  */
  200. #if defined (_STDDEF_H) || defined (__need_wchar_t)
  201. #ifndef _WCHAR_T
  202. #ifndef _T_WCHAR_
  203. #ifndef _T_WCHAR
  204. #ifndef __WCHAR_T
  205. #ifndef _WCHAR_T_
  206. #ifndef _WCHAR_T_DEFINED_
  207. #ifndef _WCHAR_T_H
  208. #ifndef ___int_wchar_t_h
  209. #ifndef __INT_WCHAR_T_H
  210. #ifndef _GCC_WCHAR_T
  211. #define _WCHAR_T
  212. #define _T_WCHAR_
  213. #define _T_WCHAR
  214. #define __WCHAR_T
  215. #define _WCHAR_T_
  216. #define _WCHAR_T_DEFINED_
  217. #define _WCHAR_T_H
  218. #define ___int_wchar_t_h
  219. #define __INT_WCHAR_T_H
  220. #define _GCC_WCHAR_T
  221.  
  222. /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
  223.    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
  224.    symbols in the _FOO_T_ family, stays defined even after its
  225.    corresponding type is defined).  If we define wchar_t, then we
  226.    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
  227.    we undef _WCHAR_T_, then we must also define rune_t, since 
  228.    headers like runetype.h assume that if machine/ansi.h is included,
  229.    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
  230.    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
  231.    the same type." */
  232. #ifdef _BSD_WCHAR_T_
  233. #undef _BSD_WCHAR_T_
  234. #ifdef _BSD_RUNE_T_
  235. #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
  236. typedef _BSD_RUNE_T_ rune_t;
  237. #endif
  238. #endif
  239. #endif
  240.  
  241. #ifndef __WCHAR_TYPE__
  242. #define __WCHAR_TYPE__ int
  243. #endif
  244.  
  245. #endif /* not  amigados */
  246. typedef __WCHAR_TYPE__ wchar_t;
  247. #endif
  248. #endif
  249. #endif
  250. #endif
  251. #endif
  252. #endif
  253. #endif
  254. #endif
  255. #endif
  256. #endif
  257. #undef    __need_wchar_t
  258. #endif /* _STDDEF_H or __need_wchar_t.  */
  259.  
  260. /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
  261.     are already defined.  */
  262. #ifdef _ANSI_H_
  263. /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
  264.     are probably typos and should be removed before 2.7 is released.  */
  265. #ifdef _GCC_PTRDIFF_T_
  266. #undef _PTRDIFF_T_
  267. #endif
  268. #ifdef _GCC_SIZE_T_
  269. #undef _SIZE_T_
  270. #endif
  271. #ifdef _GCC_WCHAR_T_
  272. #undef _WCHAR_T_
  273. #endif
  274. /*  The following ones are the real ones.  */
  275. #ifdef _GCC_PTRDIFF_T
  276. #undef _PTRDIFF_T_
  277. #endif
  278. #ifdef _GCC_SIZE_T
  279. #undef _SIZE_T_
  280. #endif
  281. #ifdef _GCC_WCHAR_T
  282. #undef _WCHAR_T_
  283. #endif
  284. #endif /* _ANSI_H_ */
  285.  
  286. #endif /* __sys_stdtypes_h */
  287.  
  288. /* A null pointer constant.  */
  289.  
  290. #if defined (_STDDEF_H) || defined (__need_NULL)
  291. #undef NULL        /* in case <stdio.h> has defined it. */
  292. #define NULL ((void *)0)
  293. #endif    /* NULL not defined and <stddef.h> or need NULL.  */
  294. #undef    __need_NULL
  295.  
  296. #ifdef _STDDEF_H
  297.  
  298. /* Offset of member MEMBER in a struct of type TYPE.  */
  299.  
  300. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  301.  
  302. #endif /* _STDDEF_H was defined this time */
  303.  
  304. #endif /* __STDDEF_H__ was not defined before */
  305. #endif /* _ANSI_STDDEF_H was not defined before */
  306. #endif /* _STDDEF_H_ was not defined before */
  307. #endif /* _STDDEF_H was not defined before */
  308.